package com.gec.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gec.mapper.SysOperLogMapper;
import com.gec.model.system.SysOperLog;
import com.gec.model.vo.SysOperLogQueryVo;
import com.gec.system.service.SysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements SysOperLogService {
    @Autowired
    private SysOperLogMapper sysOperLogMapper;

    @Override
    public IPage<SysOperLog> selectPage(Long page, Long limit, SysOperLogQueryVo sysOperLogQueryVo) {
        Page<SysOperLog> pageParam=new Page(page,limit);
        String operName = sysOperLogQueryVo.getOperName();

        QueryWrapper<SysOperLog> wrapper=new QueryWrapper<>();
        if(!StringUtils.isEmpty(operName)){
            wrapper.like("oper_name",operName);
        }
        IPage<SysOperLog> iPage=sysOperLogMapper.selectPage(pageParam,wrapper);
        return iPage;
    }

    @Override
    public int removeById(Long id) {
        return this.sysOperLogMapper.deleteById(id);
    }

    @Override
    public int removeIds(List<Long> ids) {
        return this.sysOperLogMapper.deleteBatchIds(ids);
    }

}
